﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsMobile(Request.UserAgent))
        {
            Response.Redirect(@"~\Mobile.aspx");
        }

    }

    public static bool IsMobile(string userAgent)
    {
        userAgent = userAgent.ToLower();
        return userAgent.Contains("iphone") ||
              userAgent.Contains("ppc") ||
              userAgent.Contains("windows ce") ||
              userAgent.Contains("blackberry") ||
              userAgent.Contains("opera mini") ||
              userAgent.Contains("mobile") ||
              userAgent.Contains("palm") ||
              userAgent.Contains("portable");
    }
    }

